<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
	<%@ include file="/common/view/header.jsp"%>
	<script>
	function addTab(title, href){
		parent.addTab(title, '<%=cp%>'+href);
	}
	$(function(){
		$.ajax({
 			type: "GET",
 			url: "<%=cp%>/rbac/sysmenu?rnd="+Math.random(),
 			dataType: "json",
 			success: function(data) {
 				var menulist = "";
 				var _menus = eval(data);
 				for(var i=0; i<_menus.length; i++){
 					menulist += "<div title=\""+_menus[i].groupname+"\" data-options=\"iconCls:'"+_menus[i].icon+"'\"  class=\"nav-title\">";
 					var menuitem = _menus[i].children;
 					for(var j=0; j<menuitem.length; j++){
 						menulist += "	<div class=\"nav-item\">";
 						menulist += "		<img src=\""+menuitem[j].icon+"\" width=\"16\" height=\"16\" border=\"0\" />";
						menulist += "		<a href=\"javascript:addTab(\'"+menuitem[j].title+"\',\'"+menuitem[j].url+"\')\" title=\""+menuitem[j].remark+"\" class=\"leftmenu\">";
						menulist += "			<span>"+menuitem[j].title+"</span>";
						menulist += "		</a>";
						menulist += "	</div>";
 					}
 					menulist += "</div>";
 				}
 				if(menulist==""){
 					$("#sysmenu").html("<div class=\"pub_red\">抱歉，您没有任何功能权限！</div>");
 					return;
 				}
 				
 				$("#sysmenu").html(menulist);
 				$("#sysmenu").accordion();
			},
			error: function(XMLHttpRequest, textStatus, errorThrown) {
 				alert(textStatus);
 			}
 		});
 	});
	window.onresize = function(){
		$("#sysmenu").accordion();
	}
	</script>
  </head>
  
  <body style="padding:0;margin:0;">
    <div style="overflow:auto;width:100%;height:100%;padding:0px;">
	  <div id="sysmenu" fit="true" border="false">
	    <div class="pub_yellow"><img src="<%=cp%>/common/images/loading.gif" align="absmiddle" />正在加载系统菜单，请稍候...</div>
	  </div>
	</div>
  </body>
</html>